/**
 * @FileName Client.java
 * @Package com.designMode.dynamicProxy
 * -------------------------------------
 * @function Please write description of function
 * @Date 2015-12-29 下午5:17:44
 * -------------------------------------
 * Copyright (c) 2015,顾博君 All Rights Reserved.
 */
package com.designMode.proxy.dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author 顾博君
 * @ClassName Client
 * @Date 2015-12-29 下午5:17:44
 * @Function 动态代理 场景类
 */
public class Client {
    public static void main(String[] args) {
        // 新建玩家类
        IGamePlayer player = new GamePlayer("BobbyGu");
        // 动态代理一个玩家类
        IGamePlayer proxyPlayer = (IGamePlayer) new DynamicProxy(player).proxy();
        if (proxyPlayer != null) {
            //调用代理类方法
            proxyPlayer.login("BobbyGu", "123123");
            proxyPlayer.killBoss();
            proxyPlayer.upgrade();
        }
    }
}
